﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

namespace engine
{
    class PlayerShipNode : ModelNode
    {
        float moveSpeed;

        public PlayerShipNode(String modelName)
        : base(modelName)
        {
            moveSpeed = 3.0f;
        }

        public override void Update(GameTime gameTime)
        {
            float movement = 1 * moveSpeed * gameTime.ElapsedGameTime.Milliseconds;
            if (Input.Keyboard.IsKeyDown(Keys.Up))
            {
                Local = Local * Matrix.CreateTranslation(new Vector3(0, 0, -movement));
            }
            if (Input.Keyboard.IsKeyDown(Keys.Down))
            {
                Local = Local * Matrix.CreateTranslation(new Vector3(0, 0, movement));
            }
            if (Input.Keyboard.IsKeyDown(Keys.Left))
            {
                Local = Local * Matrix.CreateTranslation(new Vector3(-movement, 0, 0));
            }
            if (Input.Keyboard.IsKeyDown(Keys.Right))
            {
                Local = Local * Matrix.CreateTranslation(new Vector3(movement, 0, 0));
            }
            base.Update(gameTime);
        }
    }
}
